package com.lysj.bhp.user.repository;


import com.lysj.bhp.user.domain.User;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;

import java.util.Date;
import java.util.List;


public interface UserRepository extends JpaRepository<User, Long>, JpaSpecificationExecutor {


    User findByToken(String token);

    User findByEmail(String email);

    User findByPhoneAndAreaCode(String phone,String areaCode);

    User findByForgetCode(String forgetCode);


    User findByUserId(Long userId);


    List<User> findByRegisterDateBetweenAndStatus(Date beginDate, Date endDate, Integer status);

    User findByEmailAndStatus(String email, int status);


    int countByAreaCodeAndPhone(String areacode, String phone);

    /**
     * @author wtl
     * @date 2018-03-08 17:15
     * @Description 通过激活码获取用户
     */
    User findByActiveCode(String activeCode);


}
